//
//  MCBankcardManageTableViewCell.m
//  TLYL
//
//  Created by MC on 2017/7/11.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCBankcardManageTableViewCell.h"
@interface MCBankcardManageTableViewCell ()
/*
 * 打底
 */
@property (nonatomic,strong)UIView * view_back;

/*
 * 图标
 */
@property (nonatomic,strong)UIImageView * imgV_logo;
/*
 * 卡的名称
 */
@property (nonatomic,strong)UILabel * lab_cardName;
/*
 * 卡号
 */
@property (nonatomic,strong)UILabel * lab_cardNumber;

@end

@implementation MCBankcardManageTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        [self initView];
    }
    return self;
}

- (void)initView{
    
    self.backgroundColor=[UIColor whiteColor];
    
    
    _view_back=[[UIView alloc]init];
    [self addSubview:_view_back];
    _view_back.backgroundColor=RGB(106, 166, 215);
    _view_back.frame=CGRectMake(10, 5, G_SCREENWIDTH-20, 80);
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_view_back.bounds byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = _view_back.bounds;
    maskLayer.path = maskPath.CGPath;
    _view_back.layer.mask = maskLayer;
    _view_back.clipsToBounds=YES;
    
    
    /*
     * logo
     */
    _imgV_logo=[[UIImageView alloc]init];
    [_view_back addSubview:_imgV_logo];
    _imgV_logo.frame=CGRectMake(10, 10, 60, 60);
    _imgV_logo.backgroundColor=[UIColor whiteColor];
//    _imgV_logo.clipsToBounds=YES;
//    _imgV_logo.layer.cornerRadius=15;

    /*
     * 卡的名称
     */
    _lab_cardName =[[UILabel alloc]initWithFrame:CGRectZero];
    _lab_cardName.textColor=[UIColor whiteColor];
    _lab_cardName.font=[UIFont boldSystemFontOfSize:18];
    _lab_cardName.text =@"加载中...";
    _lab_cardName.textAlignment=NSTextAlignmentLeft;
    [_view_back  addSubview:_lab_cardName];
    
    /*
     * 卡号
     */
    _lab_cardNumber =[[UILabel alloc]initWithFrame:CGRectZero];
    _lab_cardNumber.textColor=[UIColor whiteColor];
    _lab_cardNumber.font=[UIFont systemFontOfSize:20];
    _lab_cardNumber.text =@"加载中...";
    _lab_cardNumber.textAlignment=NSTextAlignmentLeft;
    [_view_back  addSubview:_lab_cardNumber];
    
    [self relayOutConstraints];
    
    
    
}



-(void)relayOutConstraints{
    
    
    
    [_lab_cardName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_imgV_logo.mas_top);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(G_SCREENWIDTH-90);
        make.left.equalTo(_imgV_logo.mas_right).offset(10);
    }];
    
    
    [_lab_cardNumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_lab_cardName.mas_bottom);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(G_SCREENWIDTH-90);
        make.left.equalTo(_imgV_logo.mas_right).offset(10);
    }];
    
}

-(void)setDataSource:(id)dataSource{
    
    _dataSource=dataSource;
    _lab_cardName.text =@"中国工商银行(默认卡)";
    _lab_cardNumber.text=@"****  ****  ****  0865  911";
    
    
    
    
}

+(CGFloat)computeHeight:(id)info{
    
    return 90;
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
